package com.ruoyi.project.check.controller;


import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.check.domain.CheckMode;
import com.ruoyi.project.check.service.ICheckModeService;
import com.ruoyi.project.system.domain.SysRole;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/check/mode")
public class CheckModeController extends BaseController {
    @Autowired
    private ICheckModeService checkModeService;

    /**
     * 根据检查单号查询信息
     */
    @PreAuthorize("@ss.hasPermi('check:mode:index')")
    @GetMapping(value = "list")
    public TableDataInfo list(String checkCode)
    {
        List<CheckMode> list = checkModeService.seliIcheckByCodeService(checkCode);
        return getDataTable(list);
    }

    /**
     * 修改flag的值
     */

    @PreAuthorize("@ss.hasPermi('check:mode:index')")
    // @Log(title = "检查管理", businessType = BusinessType.INSERT)
    @GetMapping("/edit/{checkCode}")
    public AjaxResult startSuccess(@PathVariable String checkCode)
    {
        return toAjax(checkModeService.updateFlag(checkCode));
    }



}
